/* GUI CONVERTED from gpincr.p (converter v1.75) Tue Aug 15 09:51:04 2000 */
/* gpincr.p - create the in_mstr record for a given part and site       */
/* Copyright 1986-2000 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*J23R*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 7.2      LAST MODIFIED: 10/05/94   BY: emb *FU29*          */
/* REVISION: 8.5      LAST MODIFIED: 07/05/97   BY: *J1PS* Felcy D'Souza*/
/* REVISION: 8.6      LAST MODIFIED: 03/03/98   BY: *J23R* Sandesh Mahagaokar */
/* REVISION: 9.0      LAST MODIFIED: 04/06/00   BY: *M0LL* Kirti Desai        */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00   BY: *N0L1* Mark Brown         */

         define input parameter     check-first     as logical NO-UNDO.
         define input parameter     part            as character NO-UNDO.
         define input parameter     site            as character NO-UNDO.
         define input parameter     gl_set          as character NO-UNDO.
         define input parameter     cur_set         as character NO-UNDO.
         define input parameter     abc             as character NO-UNDO.
         define input parameter     avg_int         as integer NO-UNDO.
         define input parameter     cyc_int         as integer NO-UNDO.
/*J1PS*/ define input parameter     rctpo_status    like pt_rctpo_status NO-UNDO.
/*J1PS*/ define input parameter     rctpo_active    like pt_rctpo_active NO-UNDO.
/*J1PS*/ define input parameter     rctwo_status    like pt_rctwo_status NO-UNDO.
/*J1PS*/ define input parameter     rctwo_active    like pt_rctwo_active NO-UNDO.
/*J1PS*/ define output parameter    inrecno         as recid NO-UNDO.
         define shared variable global_db as character.
         
         if check-first then do:
             /*J23R*find*/ for first si_mstr
/*M0LL** /*J23R*/     fields(si_db si_gl_set si_site)       */
/*M0LL*/         fields(si_cur_set si_db si_gl_set si_site)
         no-lock where si_site = site /*no-error*/: end.
             if not available si_mstr then leave.
             if si_db <> global_db then leave.
             /*J23R*find*/ for first pt_mstr
/*J23R*/     fields(pt_abc pt_avg_int pt_cyc_int pt_part pt_rctwo_active
/*J23R*/            pt_rctpo_status pt_rctpo_active pt_rctwo_status)
         no-lock where pt_part = part /*no-error*/: end.
             if not available pt_mstr then leave.
             assign gl_set       = si_gl_set
/*J1PS**            cur_set      = si_gl_set   */
/*J1PS*/            cur_set      = si_cur_set
                    abc          = pt_abc
                    avg_int      = pt_avg_int
                    cyc_int      = pt_cyc_int
/*J1PS*/            rctpo_status = pt_rctpo_status
/*J1PS*/            rctpo_active = pt_rctpo_active
/*J1PS*/            rctwo_status = pt_rctwo_status
/*J1PS*/            rctwo_active = pt_rctwo_active.
         end. /*IF CHECK-FIRST */
         /*J23R*find*/ for first in_mstr
/*J23R*/ fields(in_abc in_avg_int in_cur_set in_cyc_int in_gl_set
/*J23R*/        in_level in_mrp in_part in_site)
     no-lock where in_part = part
              and in_site = site /*no-error*/: end.
         if not available in_mstr then
     do:
            create in_mstr.
            assign in_part         = part
                   in_site         = site
                   in_gl_set       = gl_set
                   in_cur_set      = cur_set
                   in_abc          = abc
                   in_avg_int      = avg_int
                   in_cyc_int      = cyc_int
                   in_mrp          = yes
                   in_level        = 99999
/*J1PS*/           in_rctpo_status = rctpo_status
/*J1PS*/           in_rctpo_active = rctpo_active
/*J1PS*/           in_rctwo_status = rctwo_status
/*J1PS*/           in_rctwo_active = rctwo_active.
/*J1PS*/    if recid(in_mstr) = -1 then.
         end. /*IF NOT AVAILABLE in_mstr */
/*J1PS*/ assign inrecno = recid(in_mstr).
